// Tradex.Connectivity.Rithmic.h

#pragma once

#include "vcclr.h"
#include "RApi.h"

using namespace System;
using namespace System::Data::Common;
using namespace System::IO;
using namespace System::Reflection;
using namespace RApi;

using namespace Tradex;
using namespace Tradex::Trading;

namespace Tradex {
	namespace Connectivity {
		namespace Rithmic {

			ref class ToolBox abstract sealed {

				static ToolBox ();

				// Here: handling of R structures - Rithmic API elements.
				// These are created (and destroyed) here, taking .NET system or Tradex elements as input.

				public :

				[System::Security::SecurityCritical ()]
				static sNCharcb CreateRString (String^ input);

				[System::Security::SecurityCritical ()]
				static void CreateRTimeStamp (DateTime input, int* pEpochSeconds, int* pMicroseconds);

				[System::Security::SecurityCritical ()]
				static void DestroyRString (sNCharcb* rString);

				[System::Security::SecurityCritical ()]
				static void FillRAccountInfo (RApi::AccountInfo* pAccountInfo, AccountKey^ accountKey);

				[System::Security::SecurityCritical ()]
				static void ClearRAccountInfo (RApi::AccountInfo* pAccountInfo);

				// Here: handling of N structures - .NET system elements.
				// Creation code to geneate them from the Rithmic counterparts.

				public:

				[System::Security::SecurityCritical ()]
				static DateTime CreateNDateTime (int epochSeconds, int microSeconds);

				[System::Security::SecurityCritical ()]
				static String^ CreateNString (sNCharcb rString);

				// Here: Handling of T structures - .NET Tradex elements.
				// Creation code to generate them from the Rithmic counterparts.

				public:

				[System::Security::SecurityCritical ()]
				static AccountKey^ CreateTAccountKey (RApi::AccountInfo acctInfo);

				private:

				static DateTime _Epoch;

			};

		}
	}
}
